package com.bright.cwduijie.duijie.repository;

import com.bright.cwduijie.duijie.pojo.po.FixedAssets;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface FixedAssetsRepository extends JpaRepository<FixedAssets, Integer>, JpaSpecificationExecutor<FixedAssets> {

    @Query("select TYSHXYDM from FixedAssets where sjjhbz=:sjjhbz group by TYSHXYDM")
    List<String> getDistinctTYSHXYDMBySjjhbz(@Param("sjjhbz") int sjjhbz);

    @Query("from FixedAssets where sjjhbz=:sjjhbz and DATA_KEY like :ztDataKey% and opType=:opType")
    List<FixedAssets> getAllByZtDataKeyAndSjjhbz(@Param("ztDataKey") String ztDataKey, @Param("sjjhbz") int sjjhbz, @Param("opType") int opType);

    @Query("select id from FixedAssets where DATA_KEY in (:dataKeys)")
    List<Integer> getIdListByDataKeys(@Param("dataKeys") List<String> dataKeys);

}